import React, { Component } from 'react';
import { View, Platform, SafeAreaView, Text,Image } from 'react-native';
// import { Provider } from 'react-redux';
// import { createStore } from 'redux';
import { createStackNavigator, createAppContainer } from 'react-navigation';
// import reducers from "./reducers";
import Home from './pages/home/index';
import TaskDetail from './pages/home/tabs/task/deatil';
import CardDetail from './pages/home/tabs/card/detail';
import Login from './pages/login';
import PhoneLogin from './pages/login/phone';
import InputPhoneCode from './pages/login/code';
import FeedBack from './pages/home/tabs/user/feedback';
import UserDetail from './pages/home/tabs/user/detail';
import UpdateNickName from './pages/home/tabs/user/updateNickName';
import UpdateSchool from './pages/home/tabs/user/updateSchool';
import UserTarget from './pages/home/tabs/user/target';
import UpdateAddress from './pages/home/tabs/user/updateAddress';
import StackViewStyleInterpolator from 'react-navigation-stack/dist/views/StackView/StackViewStyleInterpolator';
import SplashScreen from 'react-native-splash-screen';

		

const TransitionConfiguration = () => ({
    screenInterpolator: (sceneProps) => {
        const {scene} = sceneProps;
        const {route} = scene;
        // 获取屏幕切换时新屏幕的参数
        const params = route.params || {};
        // 看看参数中是否有 transition 参数，有则使用，否则使用缺省值 forHorizontal
        // forHorizontal 表示从右向左滑出
        // const transition = params.transition || 'forHorizontal';
        const  transition = "forHorizontal";
        return StackViewStyleInterpolator[transition](sceneProps);
    },
});


// const store = createStore(reducers);

const navigationOptions = title => ({
    headerStyle: {
        backgroundColor: '#ffffff',
        borderBottomWidth: 0,
        shadowOpacity: 0,
        elevation: 0,

    },
    headerTitleStyle:{
        flex:1,
        textAlign:"center",
        alignSelf:'center',
        
    },
    headerTintColor: 'black',
    headerBackTitle: null,
    gesturesEnabled: true

});

const AppContainer = createAppContainer(createStackNavigator({
  
    "/app/home":{
        screen:Home,
        navigationOptions:navigationOptions("今天的任务")
    },
    "/app/login":{
        screen:Login,
        navigationOptions:navigationOptions("登录")
    },
    "/app/login/phone":{
        screen:PhoneLogin,
        navigationOptions:navigationOptions("手机登录")
    },
    "/app/login/phone/code":{
        screen:InputPhoneCode,
        navigationOptions:navigationOptions("手机登录")
    },
    "/task/detail":{
        screen:TaskDetail,
        navigationOptions:navigationOptions("任务详情")
    },
    "/card/detail":{
        screen:CardDetail,
        navigationOptions:navigationOptions("答题卡")
    },
    "/user/feedback":{
        screen:FeedBack,
        navigationOptions:navigationOptions("")
    },
    "/user/detail":{
        screen:UserDetail,
        navigationOptions:navigationOptions("")
    },
    "/user/update/nickname":{
        screen:UpdateNickName,
        navigationOptions:navigationOptions("")
    },
    "/user/update/school":{
        screen:UpdateSchool,
        navigationOptions:navigationOptions("")
    },
    "/user/update/address":{
        screen:UpdateAddress,
        navigationOptions:navigationOptions("")
    },
    "/user/target":{
        screen:UserTarget,
        navigationOptions:navigationOptions("")
    }
  
},{
    // mode:"card",
    // transitionConfig:TransitionConfiguration
}));
/**
 * 
 */
export default class App extends Component{


    constructor(props){
        super(props);
        SplashScreen.hide();
       
    }

    
    render(){
        return (
           <AppContainer />
        )
    }

}